package lab6_5_4;

import java.util.Scanner;

class Student{
	private String name;
	private int score;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		if(Character.isDigit(this.name.charAt(0)))
			throw new IllegalNameException(String.format("the first char of name must not be digit, name=", this.name));
		this.name = name;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	@Override
	public String toString() {
		return "Student [name=" + name + ", score=" + score + "]";
	}
	public int addScore(int score) throws IllegalScoreException{
		int allscore=0;
		allscore+=score;
		if(allscore<0||allscore>100){
			allscore-=score;
				throw new IllegalScoreException(String.format("score out of range, score="+allscore));
			
			
		}
		return allscore;
	}
}
public class Main {

	public static void main(String[] args){
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		while(sc.hasNextLine()){
			String str=sc.nextLine();
			if(str.equals("new")){
				Student s=new Student();
				
				try {
					s.setName(sc.next());
					s.setScore(sc.nextInt());
					System.out.println(s.toString());
					
				} catch (IllegalNameException e) {
					// TODO Auto-generated catch block
					System.out.println(e);
					break;
				}
			}
			sc.close();
			System.out.println("scanner closed");
			
			
		}
	}

}
